import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '链接名',
    align: "center",
    dataIndex: 'linkName'
  },
  {
    title: '链接url',
    align: "center",
    dataIndex: 'linkUrl'
  },
  {
    title: '排序号',
    align: "center",
    dataIndex: 'sort'
  },
  {
    title: '是否开启',
    align: "center",
    dataIndex: 'isOpen',
    customRender:({text}) => {
       return  text?'开启':'不开启'
     },
  },
];
columns.forEach(item=>{
  item.resizable=true
})
//查询数据
export const searchFormSchema: FormSchema[] = [
];

//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '链接名',
    field: 'linkName',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入链接名!'},
             ];
    },
  },
  {
    label: '链接url',
    field: 'linkUrl',
    component: 'Input',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入链接url!'},
             ];
    },
  },
  {
    label: '排序号',
    field: 'sort',
    component: 'InputNumber',
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入排序号!'},
             ];
    },
  },
  {
    label: '是否开启，0：不开启，1：开启',
    field: 'isOpen',
    component: 'JSwitch',
    componentProps:{
    },
    dynamicRules: ({model,schema}) => {
      return [
              { required: true, message: '请输入是否开启，0：不开启，1：开启!'},
             ];
    },
  },
	// TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
